home *** CD-ROM | disk | FTP | other *** search
- /*
- $VER: UnDMS.dopus5 1.4 (10.6.95)
- Written by Edmund Vermeulen (edmundv@grafix.xs4all.nl).
-
- ARexx script for Directory Opus 5 to unpack a DMS file to disk with
- progress indication.
-
- To use it you may call it from the 'Double-click' function for the
- 'DiskMasher archive' filetype. Enter the following command:
-
- <ARexx> DOpus5:arexx/UnDMS.dopus5 {f} {Qp} CLOSE
-
- and set the 'Run asynchronously' flag.
-
- The optional CLOSE keyword will cause the lister to be closed immediately
- instead of reading the directory.
- */
-
- parse arg '"' dmsfile '"' portname cmd .
-
- if portname='' then
- portname='DOPUS.1'
- address value portname
-
- cuthere=lastpos('/',dmsfile)
- if cuthere=0 then
- cuthere=pos(':',dmsfile)
- dmsname="'"substr(dmsfile,cuthere+1)"'"
-
- closecmd=(upper(cmd)='CLOSE')
-
- options results
- lf='0a'x /* ascii code for linefeed */
-
- if ~show('l','rexxsupport.library') then
- call addlib('rexxsupport.library',0,-30)
-
- n=1
- dests=''
- drives='DF_0|DF_1|DF_2|DF_3'
-
- /* check if these drives are really available */
-
- do until drives=''
- parse var drives drive '|' drives
- devname=compress(drive,'_')
- if showlist('h',devname) then do
- dest.n=devname':'
- dests=dests||drive'|'
- n=n+1
- end
- end
-
- /* RAD is always shown */
-
- dest.n='RAD:'
- dests=dests'_RAD|'
-
- dopus request '"Please insert disk in drive and then select'lf'destination for' dmsname'."' dests'Cancel'
- no=rc
- if no=0 then
- exit
- if dest.no='RAD:'&~showlist('h','RAD') then
- address command 'Mount RAD:' /* automatically mount RAD: */
-
- lister new
- handle=result
-
- lister set handle busy on
- lister set handle path dest.no
- lister set handle progress 80 'Unpacking' dmsname'...'
- lister set handle title 'Unpacking' dmsname'...'
- lister refresh handle full
-
- /* wow! some clever stuff here... */
- address command 'Run >NIL: <NIL: DMS <NIL: >PIPE:dmsout WRITE "'dmsfile'" TO' dest.no 'NOTEXT'
- address command 'Status >T:ProcessNo COMMAND DMS'
- call open('temp','T:ProcessNo','r')
- process=readln('temp')
- close('temp')
- address command 'Delete >NIL: T:ProcessNo QUIET'
-
- nomessage=1
- errorreport=''
- buffer=''
- call open('dmsout','PIPE:dmsout','r') /* output from DMS comes through PIPE: */
-
- do until eof('dmsout')
- buffer=buffer||readch('dmsout',25) /* read portions of 25 characters */
- here=verify(buffer,'0a0d'x,'m') /* check for new lines */
- if here>0 then do
- line=left(buffer,here-1) /* one whole line */
- if nomessage&left(line,7)='No Disk' then do
- lister set handle progress name 'Insert disk in' strip(dest.no,'t',':')
- nomessage=0
- end
- parse var line ' ' line /* get rid of some ugly stuff */
- buffer=substr(buffer,here+1)
- if pos('ERROR',upper(line))>0 then do
- errorreport=errorreport||lf||line
- command beep
- end
- if pos('unPacking',line)>0 then do
- track=right(line,2)
- lister set handle progress count track+1
- lister set handle progress name 'Track' track
- lister query handle abort
- if result then do
- address command 'Break' process 'C'
- if closecmd then do
- lister set handle busy off
- lister close handle
- end
- else do
- lister set handle title 'UnDMS aborted...'
- lister refresh handle full
- lister set handle title /* reset title */
- lister set handle busy off
- end
- exit
- end
- end
- end
- end
-
- call close('dmsout')
-
- if errorreport~=='' then
- dopus request '"Error Report'lf||errorreport'" OK'
-
- lister set handle title /* reset title */
- lister set handle busy off
-
- if closecmd then
- lister close handle
- else
- lister read handle dest.no force
-